const Command=function(){
    this.commands=[]
    this.times=1
    this.ID=Math.round(Math.random()*100000)
    this.add=function(command){
        this.commands.push(command)
        return this
    }
    this.id=function(s){
     this.ID = s   
     return this
    }
    this.exit = function(time){
        this.times = time
        return this
    }
    this.build = function(){
        if(this.ID==-1){
          return "["+this.commands.join(";")+"]("+this.times+")&"
        }else{
          return "id="+this.ID+"&["+this.commands.join(";")+"]("+this.times+")&"
        }
    }
}

const Mode = function(pin,mode){
    return "M"+pin+"="+mode
}
const Write = function(pin,mode){
    return "S"+pin+"="+mode
}
const Read = function(pin,mode){
    return "G"+pin+"="+mode
}
const Delay = function(time){
    return "D"+"="+time
}
const DelayMicroseconds = function(time){
    return "d"+"="+time
}
const PWM= function(pin,time){
    return "P"+pin+"="+time
}